package zlx.springcloud.control;


import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import zlx.springcloud.domain.CommonResult;
import zlx.springcloud.service.AccountService;

import javax.annotation.Resource;
import java.math.BigDecimal;

@RestController
public class AccountController {
    /**
     * 扣减库存
     */
    @Resource
    private AccountService accountService;
    @PostMapping(value = "/account/decrease")
    CommonResult decrease(@RequestParam("userId") Long userId,@RequestParam("money") BigDecimal money){
        accountService.desrease(userId,money);
        return new CommonResult(200,"扣减库存成功");
    }
}
